import cx from 'classnames';
import React from 'react';
import webGlControl from './control';
import styles from './index.less';

interface ViewProps extends React.HTMLAttributes<HTMLSpanElement> {
  active?: boolean;
}
export default class ButtonDayNight3D extends React.Component<ViewProps> {
  public componentDidMount() {
    webGlControl.init('three-comp-day-night-btn');
  }
  public componentWillUnmount() {
    webGlControl.destroy();
  }
  public render() {
    const { active, className, children, ...restProps } = this.props;

    return (
      <div
        id="three-comp-day-night-btn"
        className={cx(styles.button, { [styles.night]: active }, className)}
        {...restProps}
      ></div>
    );
  }
}
